\name{addHistogram}
\Rdversion{1.1}
\alias{addHistogram}

\title{
adds a histogram
}
\description{
adds a histogram
}
\usage{
addHistogram(data, numCats, titleHist, attrName, numHistBarsPerCat, coloursForMap)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{data}{
%%     ~~Describe \code{data} here~~
}
  \item{numCats}{
%%     ~~Describe \code{numCats} here~~
}
  \item{titleHist}{
%%     ~~Describe \code{titleHist} here~~
}
  \item{attrName}{
%%     ~~Describe \code{attrName} here~~
}
  \item{numHistBarsPerCat}{
%%     ~~Describe \code{numHistBarsPerCat} here~~
}
  \item{coloursForMap}{
%%     ~~Describe \code{coloursForMap} here~~
}
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}



\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(data,numCats,titleHist,attrName,numHistBarsPerCat,coloursForMap){

        if (titleHist!="") {
        #} else if ( logIndex ) {titleHist <- paste("Log",attrName)
        } else titleHist <- attrName

        #set breaks for histogram

        #16/3/09 numHistBarsPerCat doesn't work with new method of classifying
        #thats Ok we may just set it to 1 permanently : it was dificult for people to get their head around anyway

        #breaksVector <- seq( from=min(dFbyCountry[[colNameRaw]],na.rm=TRUE),to= max(dFbyCountry[[colNameRaw]],na.rm=TRUE), length.out=numHistBreaks )
        numHistBreaks <- 1 + numCats * numHistBarsPerCat
        #breaksVector <- seq( from=min(sGDF[[attrName]],na.rm=TRUE),to=max(sGDF[[attrName]],na.rm=TRUE), length.out=numHistBreaks )
        breaksVector <- seq( from=0,to=numCats, length.out=numHistBreaks )
        #cols4Hist <- rep(1:numCats, each=numHistBarsPerCat)
        #16/3/09 allowing colours to be set from palette
        cols4Hist <- rep(coloursForMap, each=numHistBarsPerCat)

        #******
        #** would need to subset this by the spatial extents passed to the method
        #** if I want the histogram just to display those in the zoomed map
        hist(data, main=titleHist, breaks=breaksVector, col=cols4Hist)
  }
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{aplot }

